home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / CellHints.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  4.8 KB  |  204 lines

  1. package symantec.itools.db.awt;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Rectangle;
  7.  
  8. public class CellHints {
  9.    Rectangle bounds = new Rectangle();
  10.    int align;
  11.    int valign;
  12.    boolean editable = true;
  13.    boolean visible = true;
  14.    Font font;
  15.    // $FF: renamed from: fg java.awt.Color
  16.    Color field_0;
  17.    // $FF: renamed from: bg java.awt.Color
  18.    Color field_1;
  19.    Color hfg;
  20.    Color hbg;
  21.    boolean highlighted;
  22.    boolean lineTop;
  23.    boolean lineBottom;
  24.    boolean lineLeft;
  25.    boolean lineRight;
  26.    int lineTopStyle;
  27.    int lineBottomStyle;
  28.    int lineLeftStyle;
  29.    int lineRightStyle;
  30.    Color lineTopColor;
  31.    Color lineBottomColor;
  32.    Color lineLeftColor;
  33.    Color lineRightColor;
  34.    TableCell defaultCell;
  35.    public static Font stdFont = new Font("Dialog", 0, 12);
  36.    Grid view;
  37.    TableCell cell;
  38.  
  39.    public CellHints(Grid v) {
  40.       this.font = stdFont;
  41.       this.field_0 = Color.black;
  42.       this.field_1 = Color.white;
  43.       this.hfg = Color.white;
  44.       this.hbg = Color.blue;
  45.       this.highlighted = false;
  46.       this.lineTop = true;
  47.       this.lineBottom = true;
  48.       this.lineLeft = true;
  49.       this.lineRight = true;
  50.       this.lineTopStyle = 1;
  51.       this.lineBottomStyle = 1;
  52.       this.lineLeftStyle = 1;
  53.       this.lineRightStyle = 1;
  54.       this.lineTopColor = Color.gray;
  55.       this.lineBottomColor = Color.gray;
  56.       this.lineLeftColor = Color.gray;
  57.       this.lineRightColor = Color.gray;
  58.       this.view = v;
  59.    }
  60.  
  61.    public void setForeground(Graphics g) {
  62.       if (this.highlighted) {
  63.          g.setColor(this.hfg);
  64.       } else {
  65.          g.setColor(this.field_0);
  66.       }
  67.    }
  68.  
  69.    public void setBackground(Graphics g) {
  70.       if (this.highlighted) {
  71.          g.setColor(this.hbg);
  72.       } else {
  73.          g.setColor(this.field_1);
  74.       }
  75.    }
  76.  
  77.    public void setHints(TableCell c) {
  78.       this.cell = c;
  79.       this.bounds = this.view.getCellBounds(c, this.bounds);
  80.       this.align = this.view.getCellAlignment(c);
  81.       this.field_0 = this.view.getCellFG(c);
  82.       this.field_1 = this.view.getCellBG(c);
  83.       this.editable = this.view.getCellEditable(c);
  84.       this.highlighted = this.view.getCellHighlighted(c);
  85.       this.font = this.view.getCellFont(c);
  86.    }
  87.  
  88.    public void drawBoundary(Graphics g) {
  89.       Rectangle r = this.bounds;
  90.       if (this.lineTop) {
  91.          g.setColor(this.lineTopColor);
  92.          g.drawLine(r.x, r.y, r.x + r.width - 1, r.y);
  93.       }
  94.  
  95.       if (this.lineBottom) {
  96.          g.setColor(this.lineBottomColor);
  97.          g.drawLine(r.x, r.y + r.height - 1, r.x + r.width - 1, r.y + r.height - 1);
  98.       }
  99.  
  100.       if (this.lineLeft) {
  101.          g.setColor(this.lineLeftColor);
  102.          g.drawLine(r.x, r.y, r.x, r.y + r.height - 1);
  103.       }
  104.  
  105.       if (this.lineRight) {
  106.          g.setColor(this.lineRightColor);
  107.          g.drawLine(r.x + r.width - 1, r.y, r.x + r.width - 1, r.y + r.height - 1);
  108.       }
  109.  
  110.    }
  111.  
  112.    public boolean isVisible() {
  113.       return this.visible;
  114.    }
  115.  
  116.    public Rectangle bounds() {
  117.       return this.bounds;
  118.    }
  119.  
  120.    public int alignment() {
  121.       return this.align;
  122.    }
  123.  
  124.    public boolean editable() {
  125.       return this.editable;
  126.    }
  127.  
  128.    public int vAlignment() {
  129.       return this.valign;
  130.    }
  131.  
  132.    public Font font() {
  133.       return this.font;
  134.    }
  135.  
  136.    public Color foreground() {
  137.       return this.field_0;
  138.    }
  139.  
  140.    public Color background() {
  141.       return this.field_1;
  142.    }
  143.  
  144.    public boolean highlighted() {
  145.       return this.highlighted;
  146.    }
  147.  
  148.    public Color hlForeground() {
  149.       return this.hfg;
  150.    }
  151.  
  152.    public Color hlBackground() {
  153.       return this.hbg;
  154.    }
  155.  
  156.    public boolean lineTop() {
  157.       return this.lineTop;
  158.    }
  159.  
  160.    public boolean lineBottom() {
  161.       return this.lineBottom;
  162.    }
  163.  
  164.    public boolean lineLeft() {
  165.       return this.lineLeft;
  166.    }
  167.  
  168.    public boolean lineRight() {
  169.       return this.lineRight;
  170.    }
  171.  
  172.    public Color lineTopColor() {
  173.       return this.lineTopColor;
  174.    }
  175.  
  176.    public Color lineBottomColor() {
  177.       return this.lineBottomColor;
  178.    }
  179.  
  180.    public Color lineLeftColor() {
  181.       return this.lineLeftColor;
  182.    }
  183.  
  184.    public Color lineRightColor() {
  185.       return this.lineRightColor;
  186.    }
  187.  
  188.    public int lineTopStyle() {
  189.       return this.lineTopStyle;
  190.    }
  191.  
  192.    public int lineBottomStyle() {
  193.       return this.lineBottomStyle;
  194.    }
  195.  
  196.    public int lineLeftStyle() {
  197.       return this.lineLeftStyle;
  198.    }
  199.  
  200.    public int lineRightStyle() {
  201.       return this.lineRightStyle;
  202.    }
  203. }
  204.